<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <!-- <a href="http://www.baidu.com">百度</a> -->
    </div>
    <script>
        // 在js中 实现一个 给div内添加一个a标签，并且能点击到baidu


        // 在html拼接情况下 - 模板字符串会经常用到
        let box = document.querySelector('.box');

        let href = "http://www.baidu.com";
        let name = "百度";

        box.innerHTML = `
            <a target="_blank" href="${href}">
                ${name}
            </a>
        `;




    </script>
</body>
</html>